﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Tanmia.Core;
using Tanmia.Domain;
using System.Windows.Data;

namespace Tanmia.Windows.SearchScenario
{
    public class StatementViewModel
    {
        public Statement Entity { get; set; }

        public ICollectionView Persons { get; private set; }

        private IList<Person> Castomers = new List<Person>();
        private IList<Person> Merchants = new List<Person>();

        private PersonDomain PersonObj = new PersonDomain();
        private VoucherDomain VoucherObj = new VoucherDomain();

        public StatementViewModel()
        {
            Castomers = PersonObj.GetsByType(PersonTypeEnum.Customer);
            Merchants = PersonObj.GetsByType(PersonTypeEnum.Merchant);

            UpdatePersons(PersonTypeEnum.Customer);
        }

        public void UpdatePersons(PersonTypeEnum personType)
        {
            if (personType == PersonTypeEnum.Customer)
                Persons = CollectionViewSource.GetDefaultView(Castomers);
            else
                Persons = CollectionViewSource.GetDefaultView(Merchants);
        }
    }
}
